<!DOCTYPE HTML>
<html>
    <head>
        <title>Worker example: One-core computation</title>
        <script src="../lib/jquery.js">
        </script>
        <script type="text/javascript" src="../../src/javascript/alex.core.js">
        </script>
        <script type="text/javascript" src="../../src/javascript/alex.service.js">
        </script>
        <script>
            var outputService = new alex.service.Service("outputService", {
                output: function(message){
                    document.getElementById('result').textContent = message;
                },
				alert: function(message) {
					alert(message);
				}
            });
            var primeService = null;
            $(document).ready(function(){
				// create prime service, outputService is exported to this service
                alex.service.load("prime.js", function(services, error){
                    primeService = services.primeService;
                    $(":button:disabled").attr("disabled", false);
                }, ["outputService"]);
            });
        </script>
    </head>
    <body>
        <p>
            The highest prime number discovered so far is: <span id="result"></span>
        </p>
        <input type="button" disabled onclick="primeService.startCalculation()" value="Start">
        <input type="button" disabled onclick="primeService.pauseCalculation()" value="Pause">
        <input type="button" disabled onclick="primeService.stopCalculation()" value="Stop">
    </body>
</html>
